Learn R Programming

MXM (version 0.9.5)

Backward selection regression: Variable selection in regression models with forward selection

Description

Variable selection in regression models with forward selection

Usage

bs.reg(target, dataset, threshold = 0.05, test = NULL, wei = NULL, user_test = NULL, heavy = FALSE, robust = FALSE)

Arguments

target
The class variable. Provide either a string, an integer, a numeric value, a vector, a factor, an ordered factor or a Surv object. See also Details.
dataset
The dataset; provide either a data frame or a matrix (columns = variables, rows = samples). In either case, only two cases are avaialble, either all data are continuous, or categorical.
threshold
Threshold (suitable values in [0,1]) for asmmmbsing p-values significance. Default value is 0.05.
test
The regression model to use. Available options are most of the tests for SES and MMPC. The ones NOT available are "gSquare", "censIndER", "testIndMVreg", "testIndClogit", "testIndBinom", "testIndSpearman" and "testIndFisher".
wei
A vector of weights to be used for weighted regression. The default value is NULL. It is not suggested when robust is set to TRUE.
user_test
A user-defined conditional independence test (provide a closure type object). Default value is NULL. If this is defined, the "test" argument is ignored.
heavy
A boolean variable specifying whether heavy computations are required or not. If for exmaple the dataset contains tens of thousands of rows, it is advised to used memory efficient GLMs and hence set this to TRUE.
robust
A boolean variable which indicates whether (TRUE) or not (FALSE) to use a robust version of the statistical test if it is available. It takes more time than a non robust version but it is suggested in case of outliers. Default value is FALSE.

Value

The output of the algorithm is S3 object including: The output of the algorithm is S3 object including:

Details

This functions currently implements only linear, binary logistic and Poisson regression. If the sample size is less than the number of variables a meesage will appear and no backward regression is performed.

See Also

glm.fsreg, lm.fsreg, bic.fsreg, bic.glm.fsreg, CondIndTests, MMPC, SES

Examples

Run this code
set.seed(123)
#simulate a dataset with continuous data
dataset <- matrix( runif(1000 * 10, 1, 100), ncol = 10 )

#define a simulated class variable 
target <- rnorm(1000)

a <- bs.reg(target, dataset, threshold = 0.05, test = "testIndRQ") 
b <- bs.reg(target, dataset, threshold = 0.05, test = "testIndReg") 

Run the code above in your browser using DataLab